//
// Created by Jisam on 06/10/2024 14:22.
// Solution of  b
#include <bits/stdc++.h>

#define  int long long
#define  endl "\n"
#define  all(x) (x).begin(),(x).end()
using namespace std;


signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int t;
    cin >> t;
    while (t--) {
        int n, x;
        cin >> n >> x;
        vector<int> a(n);
        map<int, int> mp;
        for (int i = 0; i < n; i++) {
            cin >> a[i];
            mp[a[i]]++;
        }
        sort(all(a));
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (mp.find(i) != mp.end()) {
                ans = i + 1;
            }else{
                break;
            }
        }

    }

    return 0;
}